/*
package com.bestom.t9.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.util.Log;
import android.widget.Toast;

import com.bestom.t9.activity.PowerActivity;
import com.bestom.t9.service.SerialPortService;



*/
/**
 * @author ..
 *//*

public class StartReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {

        //此处及是重启的之后，打开我们app的方法
        String action = intent.getAction();
        if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
            Intent intentService= new Intent(context, SerialPortService.class);
            // 非常重要，如果缺少的话，程序将在启动时报错
            intentService.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            //自启动服务（Service）
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                context.startForegroundService(new Intent(context, SerialPortService.class));
            } else {
                context.startService(new Intent(context, SerialPortService.class));
            }

            Toast.makeText(context,"已开启监听电量服务", Toast.LENGTH_SHORT).show();
        }else if (Intent.ACTION_SHUTDOWN.equals(action)) {
            Log.e("StartReceiver","收到广播 ： " + intent.getAction());
            new PowerActivity().closeAll();
        }else {
            Log.e("StartReceiver","收到广播 ： " + intent.getAction());
        }
    }
}
*/
